package com.yiren.dbaa.net.bean;

import org.apache.commons.lang.StringUtils;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;

import java.io.Serializable;

/**
 * Created by WANGRONGXIANG
 * on 2022/3/4
 * Describe 练车学员信息
 */
public class StudentBean implements Serializable {

    private static final long serialVersionUID = 6388442924829017979L;

    @Id(autoincrement = true)//设置自增长
    private Long id;

    @Index(unique = true)//设置唯一性
    private String student;    //学员id
    private String coachId;    //教练id
    private String studentName;
    private int code;          //0：免费播报 1：体验券 2：测试 3：智能评判
    private String createTime;
    private String remaining;
    private String expiryDate;
    /**
     * 免费是否开启 0：开启 1：禁用
     */
    private int isAllowUse;
    /**
     * 免费模式禁用提示内容
     */
    private String turnOffTips;

    @Generated(hash = 246912722)
    public StudentBean(Long id, String student, String coachId, String studentName, int code, String createTime,
                       String remaining, String expiryDate, int isAllowUse, String turnOffTips) {
        this.id = id;
        this.student = student;
        this.coachId = coachId;
        this.studentName = studentName;
        this.code = code;
        this.createTime = createTime;
        this.remaining = remaining;
        this.expiryDate = expiryDate;
        this.isAllowUse = isAllowUse;
        this.turnOffTips = turnOffTips;
    }

    @Generated(hash = 1556870573)
    public StudentBean() {
    }

    public String getStudent() {
        if (student.contains(".")) {
            student = String.valueOf(Double.valueOf(student).intValue());
        }
        return student;
    }

    public void setStudent(String student) {
        if (student.contains(".")) {
            student = String.valueOf(Double.valueOf(student).intValue());
        }
        this.student = student;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getRemaining() {
        if (StringUtils.isEmpty(remaining)) {
            return "0";
        }
        if (remaining.contains(".")) {
            remaining = String.valueOf(Double.valueOf(remaining).intValue());
        }
        return remaining;
    }

    public void setRemaining(String remaining) {
        if (remaining.contains(".")) {
            remaining = String.valueOf(Double.valueOf(remaining).intValue());
        }
        this.remaining = remaining;
    }

    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }

    public int getIsAllowUse() {
        return isAllowUse;
    }

    public void setIsAllowUse(int isAllowUse) {
        this.isAllowUse = isAllowUse;
    }

    public String getTurnOffTips() {
        return turnOffTips;
    }

    public void setTurnOffTips(String turnOffTips) {
        this.turnOffTips = turnOffTips;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", student='" + student + '\'' +
                ", studentName='" + studentName + '\'' +
                ", code=" + code +
                ", createTime='" + createTime + '\'' +
                ", remaining='" + remaining + '\'' +
                ", expiryDate='" + expiryDate + '\'' +
                ", isAllowUse=" + isAllowUse +
                ", turnOffTips='" + turnOffTips + '\'' +
                '}';
    }

    public String getCoachId() {
        return this.coachId;
    }

    public void setCoachId(String coachId) {
        this.coachId = coachId;
    }
}
